package com.just.spring4.ch2.profile;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Created by han.yuan
 * 2018/5/9
 * Profile 为不同环境下使用不同的配置提供了支持
 */
public class ProfileMain {
    public static void main(String[] args){
        AnnotationConfigApplicationContext configApplicationContext=new AnnotationConfigApplicationContext();
        configApplicationContext.getEnvironment().setActiveProfiles("prod");
        configApplicationContext.register(ProfileConfig.class);
        configApplicationContext.refresh();
        DemoBean demoBean=configApplicationContext.getBean(DemoBean.class);
        System.out.println(demoBean.getContent());
    }
}
